package com.example.jdk8.streams;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ZhangLiang
 * @Date: 2021/07/09/17:06
 * @Description: Streams(流)
 */
public class ListStreamsDemo {

    public static void main(String[] args) {
        List<String> list=new ArrayList<>(Arrays.asList("aaaa1","aaaa2","aaa3","bbbb3","dddd1","cccc0"));

        list.stream()
                .map(String::toUpperCase)  //通过map来将对象转换成其他类型
                .sorted((a,b)->b.compareTo(a))  //排序，不指定一个自定义的 Comparator 则会使用默认排序，不会修改原来数据
                .filter(s->s.startsWith("A")).forEach(System.out::println);


    }
}
